﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Objects
{
    public class Hanger
    {
        private int hangerNo;
        private Person person;

        public Person Person
        {
            get { return person; }
            set { person = value; }
        }

        public int HangerNo
        {
            get { return hangerNo; }
            set { hangerNo = value; }
        }

        public override bool Equals(object obj)
        {
           Hanger h = obj as Hanger;

            if (h!= null)
            {
                if (h.HangerNo == this.HangerNo)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }

    public class Person
    {
        private string name;
        private string adress;
        private string zipcode;
        private string hashIdentifier;
        private bool? male;
        private string birthdate;
        private List<Hanger> hangers = new List<Hanger>();

        public void addHanger(Hanger h)
        {
            if(!hangers.Contains(h))
            {
                hangers.Add(h);
            }  
        }

        public void removeHanger(Hanger h)
        {
            if (hangers.Contains(h))
            {
                hangers.Remove(h);
            }
        }

        public List<Hanger> Hanger
        {
            get { return hangers; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string Adress
        {
            get { return adress; }
            set { adress = value; }
        }

        public string Zipcode
        {
            get { return zipcode; }
            set { zipcode = value; }
        }

        public string HashIdentifier
        {
            get { return hashIdentifier; }
            set { hashIdentifier = value; }
        }

        public bool? Male
        {
            get { return male; }
            set { male = value; }
        }

        public string BirthDate
        {
            get { return birthdate; }
            set { birthdate = value; }
        }

        public override bool Equals(object obj)
        {
            Person p = obj as Person;

            if(p!=null)
            {
                if(p.HashIdentifier==this.HashIdentifier)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
